package net.xiduth.game.player.dialogues.auto;

import net.xiduth.game.player.dialogues.Dialogue;

/**
 * 
 * @author Oracle
 * 
 * Handles PvM Rewards and info.
 *
 */
public class Page5PvM extends Dialogue {


	@Override
	public void start() {
		sendOptionsDialogue("PvM Rewards - Page 5", "Bonecrusher (2000 pts.)", "Steadfast boots (3500 pts.)", "Glaiven boots (3500 pts.)" , "Ragefire boots (3500 pts.)", "Return to index.");
		stage = 4;
	}

	@Override
	public void run(int interfaceId, int option) {
		switch(stage) {
		case 3:
			end();
			break;
		case 4:
			switch(option) {
		case OPTION_1: //18337 bonecrusher price: 2000
				if (player.getPvMPoints() >= 2000) {
				player.getBank().addItem(18337, 1, true);
				player.setPvMPoints(player.getPvMPoints()
						- 2000);
				player.getInterfaceManager().closeChatBoxInterface();
				player.getInterfaceManager().sendChatBoxInterface(1189);
				player.getPackets().sendItemOnIComponent(1189, 1, 18337, 1);
				player.getPackets().sendIComponentText(1189, 4, "The item has been added to your bank.");
				stage = 3;
				}else{
				sendDialogue("You need 2000 points to buy this item." );
				stage = 3;
				}
				break;
		case OPTION_2: //21787 steadfast boots price: 3500
			if (player.getPvMPoints() >= 3500) {
			player.getBank().addItem(21787, 1, true);
			player.setPvMPoints(player.getPvMPoints()
					- 3500);
			player.getInterfaceManager().closeChatBoxInterface();
			player.getInterfaceManager().sendChatBoxInterface(1189);
			player.getPackets().sendItemOnIComponent(1189, 1, 21787, 1);
			player.getPackets().sendIComponentText(1189, 4, "The item has been added to your bank.");
			stage = 3;
			}else{
			sendDialogue("You need 3500 points to buy this item." );
			stage = 3;
			}
			break;
		case OPTION_3: //21790 glaiven boots price: 3500
			if (player.getPvMPoints() >= 3500) {
			player.getBank().addItem(21790, 1, true);
			player.setPvMPoints(player.getPvMPoints()
					- 3500);
			player.getInterfaceManager().closeChatBoxInterface();
			player.getInterfaceManager().sendChatBoxInterface(1189);
			player.getPackets().sendItemOnIComponent(1189, 1, 21790, 1);
			player.getPackets().sendIComponentText(1189, 4, "The item has been added to your bank.");
			stage = 3;
			}else{
			sendDialogue("You need 3500 points to buy this item." );
			stage = 3;
			}
			break;
		case OPTION_4: //21793 ragefire boots price: 3500
			if (player.getPvMPoints() >= 3500) {
				player.getBank().addItem(21793, 1, true);
				player.setPvMPoints(player.getPvMPoints()
						- 3500);
				player.getInterfaceManager().closeChatBoxInterface();
				player.getInterfaceManager().sendChatBoxInterface(1189);
				player.getPackets().sendItemOnIComponent(1189, 1, 21793, 1);
				player.getPackets().sendIComponentText(1189, 4, "The item has been added to your bank.");
			stage = 3;
			}else{
			sendDialogue("You need 3500 points to buy this." );
			stage = 3;
			}
			break;
		case OPTION_5:
			player.getDialogueManager().startDialogue("PvMRewards");
			break;
		default:
			end();
			break;
		}}}

	@Override
	public void finish() {

	}

}
